﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="website_admin_system_regionmagviewer" Codebehind="regionmagviewer.aspx.cs" %>

<%@ Register Src="../../admin/_root/_controls/ctlNavBar.ascx" TagName="ctlNavBar"
    TagPrefix="uc1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
    <title></title>
    <link href="../_common/styles/frame_global.css" rel="stylesheet" type="text/css" />

    <script src="../_common/scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript" src="../_common/scripts/util.js"></script>
 
    
    <script language="javascript" type="text/javascript"> 
        function window.onload() {
            LoadingTreeData("0"); 
        }
        function LoadingTreeData(_parentid) {
            $.ajax({
                async: true,
                type: "POST",
                url: "regionmagviewer.aspx",
                data: { otype: "loadingtreedata", parentid: _parentid },
                beforeSend: function() { 
                    if(_parentid == "0")
                    {
                        $("#tr_"+_parentid).empty();
                        $("#tr_"+_parentid).remove();
                        $("#tbTreeArea_"+_parentid).append("<tr class=\"trTreeAreaItems\" id=\"tr_" + _parentid + "\"><td colspan=\"3\" class=\"body\" style=\"height: 50px;\">" + $("#divTreeLoading").html() + "</td></tr>");
                    }
                    else
                    {
                        $("#tr_node_"+_parentid + "_loading").empty();
                        $("#tr_node_"+_parentid + "_loading").remove();
                        $("#tr_node_"+_parentid).append("<tr class=\"trTreeAreaItems\" id=\"tr_node_" + _parentid + "_loading\"><td colspan=\"3\" class=\"body\" style=\"height: 50px;\">" + $("#divTreeLoading").html() + "</td></tr>"); 
                    }
                },
                success: function(data, textStatus) {
                    if(_parentid == "0")
                    {
                        $("#tr_"+_parentid).empty();
                        $("#tr_"+_parentid).remove();
                    
                        $("#tbTreeArea_"+_parentid).append(data);
                    }
                    else
                    {
                        $("#tr_node_"+_parentid + "_loading").empty();
                        $("#tr_node_"+_parentid + "_loading").remove(); 
                        $("#tr_node_"+_parentid).append(data);
                    }
                }
            });
        } 
        function TreeNoteShow(_obj) {
            if (_obj.vtype == "minus") {
                $("#tr_" + _obj.regionid).css("display", "none");
                _obj.vtype = "plus";
                _obj.src = "../_imgs/admin/plus.gif";
            }
            else {
                $("#tr_" + _obj.regionid).css("display", "");
                _obj.vtype = "minus";
                _obj.src = "../_imgs/admin/minus.gif";
                 
                if (jQuery("img[parentid='" + _obj.regionid + "']").length <= 0) {
                    LoadingTreeData(_obj.regionid);
                }
            }
        }
        function TreeNoteExtendAll() {
            for(var i = 0; i <= 2; i++)
            {
                jQuery("img[layer='" + String(i) + "']").each(function() {
                   jQuery(this).trigger("click");
                });
            }
        }
        function TreeNoteMinusGruop(layer) {
            jQuery("img[layer='" + layer + "']").each(function() {
               jQuery(this).trigger("click");
            });
        }
        function OpenDia(otype, parentId)
        {
            var groupid=getUrlParam("groupid");
            switch(otype)
            {
                case "add":
                    window.location.href="regioneditor.aspx?otype=add&groupid="+groupid;
                    break;
                case "addchildnode":
                    window.location.href="regioneditor.aspx?otype=add&groupid="+groupid+"&parentid="+parentId;
                    break;
            }
        }
        function Delete(_objectId) { 
            if(confirm("你确定要执行删除操作?"))
            {
               $.ajax({
                    async: false,
                    type: "POST",
                    url: "regionmagviewer.aspx",
                    data: {
                        otype: "delete",
                        objectId: _objectId
                    },
                    success: function(data, textStatus) { 
                        if (data == "succeeded") {
                            alert("删除操作完成！");
                            LoadingTreeData();
                        }
                        else {
                            alert(data);
                        }
                    }
                });
            }
        }
        function Modify(objectId)
        {
            window.location.href="regioneditor.aspx?otype=modify&groupid="+getUrlParam("groupid")+"&regionid="+objectId;
        }
    </script>

</head>
<body>
    <form id="aspnetForm" runat="server">
    <div id="divTreeLoading" style="display: none;">
        <table style="background-color: #FFFFFF; table-layout: fixed; width: 100%; height: 100%;"
            cellpadding="0" cellspacing="0">
            <tr>
                <td style="text-align: center; border: 0px; vertical-align: middle;">
                    <div style="width: 200px; margin-left: 245px;">
                        <img border="0" src="../_imgs/admin/progress.gif" />
                        <span style="line-height: 42px;">正在加载数据 ... </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="divAreas" style=" height: 380px;">
        <div class="boxTopBar">
            <div class="boxTopBarLeft">
                <div class="navBar">
                    <uc1:ctlNavBar ID="ctlNavBar1" runat="server" />
                </div>
            </div>
            <div class="boxTopBarRight">
            </div>
        </div>
        <div class="boxMain">
            <div class="boxMainBody">
                <table cellpadding="0" cellspacing="0" class="dataListControl" style="border: 0px;">
                    <colgroup>
                        <col style="width: 80px" />
                        <col />
                    </colgroup>
                    <tbody>
                        <tr style="height: 58px;">
                            <td colspan="2" valign="top" style="padding-left: 1px;">
                                <a onclick="LoadingTreeData();" id="RefreshItems" href="#" style="display: none;">
                                </a>
                                <table class="tbsToolsBar" cellpadding="0" cellspacing="0" align="center" style="width: 800px">
                                    <colgroup>
                                        <col />
                                        <col style="width: 200px; text-align: right;" />
                                    </colgroup>
                                    <tbody>
                                        <tr style="display: inline;">
                                            <td style="border-top: 1px solid #cccccc; border-left: 1px solid #cccccc; text-align: left;"> 
                                                <input type="button" value="省份【展开 / 折叠】" id="Button1" class="btn_s" onclick="TreeNoteMinusGruop('2');" style="display: none;" />
                                            </td>
                                            <td style="border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; text-align: right;">
                                                <input type="button" id="btnAdd" class="btn_s" value="新增地区" onclick="OpenDia('add', null);" /> &nbsp;
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <table class="tbTreeArea" cellpadding="0" cellspacing="0" align="center" style="width: 800px; border-left: 0px;">
                                    <colgroup>
                                        <col />
                                        <col style="width: 120px;" />
                                        <col style="width: 120px;" /> 
                                        <col style="width: 18px;" />
                                    </colgroup>
                                    <tbody>
                                        <tr class="trTreeAreaHeader">
                                            <td style="vertical-align: middle;">
                                                类别名称
                                            </td>
                                            <td style="vertical-align: middle;">
                                                英文
                                            </td> 
                                            <td colspan="2" style="vertical-align: middle;">
                                                操作
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr style="height: 100%; padding-bottom: 10px;">
                            <td colspan="2" valign="top" style="padding-right: 0px;">
                                <div style="overflow-y: scroll; overflow-x: hidden; width: 801px; height: 100%;
                                    margin-left: auto; margin-right: auto; padding: 0px; border-bottom: 0px #CCCCCC solid;">
                                    <table class="tbTreeArea" cellpadding="0" cellspacing="0" align="center" style="margin: 0px;
                                        border-right: 1px #EEEDE5 solid; border-top: 0px; width: 782px;  border-left: 0px #CCCCCC solid;
                                        height: 100%; background: #eeeeee;">
                                        <colgroup>
                                            <col />
                                            <col style="width: 120px; padding-right: 5px;" /> 
                                            <col style="width: 120px; padding-left: 10px;" />
                                        </colgroup>
                                        <tbody id="tbTreeArea_0">
                                        </tbody>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="boxBottomBar">
            <div class="boxBottomBarLeft">
                &nbsp;
            </div>
            <div class="boxBottomBarRight">
                &nbsp;
            </div>
        </div>
    </div>
    </form>
</body>
</html>
